package com.qire.manhua.model.viewModel.impl;

import com.qire.common.widget.adapter.auto.AutoVariable;
import com.qire.common.widget.adapter.auto.annotation.AdapterEntityBind;
import com.qire.manhua.R;
import com.qire.manhua.databinding.LayoutHomeRecommendModuleAdvertBinding;
import com.qire.manhua.model.entity.HomeModuleEntity.HomeModuleAdvertEntity;
import com.qire.manhua.model.enumeration.HomeModuleType;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

/**
 * 首页 -> 推荐 -> 广告模块
 * 用于构建组合首页复合布局中的广告模块，多复合模块由 {@link HomeModuleType#buildModuleViewModels HomeModuleType} 根据集体类型来构建。
 * @see HomeModuleType#TYPE_AD
 */
@AdapterEntityBind(viewRid = R.layout.layout_home_recommend_module_advert)
public class RecommendModuleAdvertViewModel extends BaseObservable implements AutoVariable<LayoutHomeRecommendModuleAdvertBinding> {

    private final HomeModuleAdvertEntity advertEntity;

    public RecommendModuleAdvertViewModel(HomeModuleAdvertEntity advertEntity) {
        this.advertEntity = advertEntity;
    }

    @Override
    public void bindVariable(LayoutHomeRecommendModuleAdvertBinding viewBind) {
        viewBind.setRecommendModuleAdvertViewModel(this);
    }

    @Bindable
    public String getAdvertImg() {
        return advertEntity.adImgPath;
    }

}
